import router from '../../router'
import request from '../../utils/request'
const state = {
    step: {
        payAccount: "123456"
    },
    receiveAccount: {
        type: 'alipay',
        number: ""
    }
};

const actions = {
    async submitStepForm({
        commit
    }, {
        payload
    }) {

        await request({
            url: '/api/form',
            method: "POST",
            data: payload
        });
        commit('saveStepFormData', {
            payload
        })
        router.push('/form/step-form/result')
    }
}
const mutations = {
    saveStepFormData(state, {
        payload
    }) {

        state.step = {
            ...state.state,
            ...payload
        }
    }
}

export default {
    namespaced: true,
    state,
    actions,
    mutations
}